package cn.edu.zafu.bigdata.zqt.studentsystem.service.impl;

import cn.edu.zafu.bigdata.zqt.studentsystem.cli.StudentManagerSystem;
import cn.edu.zafu.bigdata.zqt.studentsystem.entity.Student;
import cn.edu.zafu.bigdata.zqt.studentsystem.service.AbstractService;
import cn.edu.zafu.bigdata.zqt.studentsystem.utils.FileUtils;
import cn.edu.zafu.bigdata.zqt.studentsystem.utils.InputUtils;

/**
 * 删除学生
 *
 * @author zqt
 */
public class DeleteStudent extends AbstractService {


    /**
     * 读取用户输入
     */
    @Override
    protected void handleUserInput() {
        Student student = InputUtils.findStudentById();
        if (student != null && InputUtils.confirm()) {
            StudentManagerSystem.studentList.remove(student);
            FileUtils.updateData();
            System.out.println("数据删除成功");
        }
    }
}
